local MagickeyChooseCell = class("MagickeyChooseCell")

local MAX_ITEM = 5

function MagickeyChooseCell:ctor()
end

function MagickeyChooseCell:start()
    for i = 1, MAX_ITEM do
        self["_card" .. i]:setCallback(handler(self, self._onTouchCard))
    end
end

function MagickeyChooseCell:updateUI(line, selectedId)
    for i = 1, MAX_ITEM do
        local data = line[i]
        if data then
            self["_card" .. i]:updateUI(data, selectedId)
            self["_card" .. i].gameObject:SetActive(true)
        else
            self["_card" .. i].gameObject:SetActive(false)
        end
    end
end

function MagickeyChooseCell:_onTouchCard(id)
    if self.customCallback then
        self.customCallback(id)
    end
end

return MagickeyChooseCell
